import request from '@/utils/request';

/**
 * 头部查询
 * @param menuId
 */
export function getTableHeaderList(menuId) {
  return request.get('/header/fields/' + menuId);
}
/**
 * 查询菜单对应表头配制
 * @param {menuId}
 */
export function getTableHeaderMsgByMenuId(menuId) {
  return request.get('/header/list?menuId=' + menuId);
}

/**
 * 查看前端表头字段表详情
 * @param {Object} data {id}
 */
export function getTableHeaderInfo(id) {
  return request.get('/header/info/' + id);
}

/**
 * 修改前端表头字段表信息
 * @param {Object} data {all}
 */
export function updateTableHeaderInfo(data) {
  return request.post('/header/update', data);
}

/**
 * 添加前端表头字段表信息
 * @param {Object} data {all}
 */
export function addTableHeaderInfo(data) {
  return request.post('/header/save', data);
}

/**
 * 修改表头配置
 * @param {Object} data {
 *   id: String(id),
 *   key: String,
 *   keySort: String,
 *   label: String,
 *   menuId: String,
 *   searchEnable: Integer,
 *   searchSql: String,
 *   searchType: Integer
 * }
 */
export function updateTableHeader(data) {
  return request.post('/headerSet/setFields', data);
}

/**
 * 添加前端表头字段表信息
 * @param {Object} data {ids}
 */
export function deleteTableHeaderByIds(data) {
  return request.post('/header/delete', data);
}
